package com.qinggeng.project.api.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.qinggeng.common.enums.OrdersDistTypeEnum;
import com.qinggeng.common.utils.DateUtils;
import com.qinggeng.project.system.domain.OrdersGift;
import com.qinggeng.project.system.domain.OrdersGoods;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

//订单大厅
@Data
public class OrdersDistDto {

    //订单ID
    private Long ordersId;

    //订单编号
    private String ordersNo;

    //预计到达时间
    private String arriveTime;
    //配送费
    private BigDecimal distPrice;
    //订单提成
    private BigDecimal percentage;
    //取货地址
    private OrdersDistAddressDto pickAddress;
    //送货地址
    private OrdersDistAddressDto sendAddress;
    //备注
    private String remark;

    //状态
    private Integer status;
    //送达时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    private String distType;

    //配送时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date distDateTime;

    private BigDecimal totalPrice;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    //订单商品
    private List<OrdersGoods> ordersGoodsList;

    private List<OrdersGift> ordersGiftList;



    public Long getOrdersId() {
        return ordersId;
    }

    public void setOrdersId(Long ordersId) {
        this.ordersId = ordersId;
    }

    public String getOrdersNo() {
        return ordersNo;
    }

    public void setOrdersNo(String ordersNo) {
        this.ordersNo = ordersNo;
    }



    public String getArriveTime() {
        if(distType.equals(OrdersDistTypeEnum.配送.getValue())&&distDateTime!=null){
            return DateUtils.parseDateToStr("MM月dd日 HH:mm",distDateTime);
        }
        return arriveTime;
    }

    public void setArriveTime(String arriveTime) {
        this.arriveTime = arriveTime;
    }

    public BigDecimal getPercentage() {
        return percentage;
    }

    public void setPercentage(BigDecimal percentage) {
        this.percentage = percentage;
    }

    public OrdersDistAddressDto getPickAddress() {
        return pickAddress;
    }

    public void setPickAddress(OrdersDistAddressDto pickAddress) {
        this.pickAddress = pickAddress;
    }

    public OrdersDistAddressDto getSendAddress() {
        return sendAddress;
    }

    public void setSendAddress(OrdersDistAddressDto sendAddress) {
        this.sendAddress = sendAddress;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public String getDistType() {
        return distType;
    }

    public void setDistType(String distType) {
        this.distType = distType;
    }

    public Date getDistDateTime() {
        return distDateTime;
    }

    public void setDistDateTime(Date distDateTime) {
        this.distDateTime = distDateTime;
    }


}
